<?php
declare (strict_types = 1);

namespace app\api\controller\mall;

use app\BaseController;
use app\common\business\Cart;
use app\common\lib\Show;
use think\facade\Request;

class Init extends BaseController
{
    /**
     * 登录初始化数据部分
     *
     * @return \think\Response
     */
    public function index()
    {
        $userId = (int) Request::header('userId');
        $cart   = new Cart();
        $count  = $cart->getCartCount($userId);
        $result = [
            'cart_num' => $count,
        ];
        return Show::success($result);
    }
}
